"""
 @Author: zzgsg
 @time: 2024/9/28 20:32
"""

# Figure S1. Comparation of the measured and simulated dSCDs.
import numpy as np
import os
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['mathtext.default'] = 'regular'


fig3, axs = plt.subplots(1, 2, figsize=(12, 5))
plt.subplots_adjust(top=0.95, bottom=0.12, right=0.97, left=0.08, hspace=0.12, wspace=0.22)
# plt.rcParams['font.size'] = 15
ax3 = axs.flatten()[0]
datax = np.load('Synthetic_profile_retrieval/O4_dSCD.npy')
datay = np.load('Synthetic_profile_retrieval/O4_dSCD_match.npy')
for j in range(10):
    ax3.scatter(np.array(datax[j]).flatten(), np.array(datay[j]).flatten(), label='AERO{}'.format(j))
# ax3.set_yticks([0, 1, 2, 3, 4, 5, 6])
# ax3.set_ylim([0, 6])
# ax3.set_xlim([0,2])
# ax3.set_xticks([0, 0.5, 1, 1.5])
ax3.legend(loc='lower right')
ax3.set_xlabel('$O_4$ $dSCD_{meassured}$ [molec $cm^{-2}$]', fontsize=15)
ax3.set_ylabel('$O_4$ $dSCD_{model}$ [molec $cm^{-2}$]', fontsize=15)
plt.setp(ax3.get_xticklabels(), fontsize=15)
plt.setp(ax3.get_yticklabels(), fontsize=15)
ax3.grid()
ax3.set_xlim([-1e43, 6.5e43])
ax3.set_ylim([-1e43, 6.5e43])
ax3.annotate('(a)', xy=(0.05, 0.95), xycoords='axes fraction', fontsize=20,
             horizontalalignment='center', verticalalignment='top')
ax3 = axs.flatten()[1]

datax = np.load('Synthetic_profile_retrieval/NO2_dSCD.npy')
datay = np.load('Synthetic_profile_retrieval/NO2_dSCD_match.npy')
for j in range(6):
    ax3.scatter(np.array(datax[j]).flatten(), np.array(datax[j]).flatten(), label='TG{}'.format(j))
ax3.legend(loc='lower right')
ax3.grid()
ax3.set_xlim([-0.5e17, 4e17])
ax3.set_ylim([-0.5e17, 4e17])
ax3.set_xlabel('$NO_2$ $dSCD_{meassured}$ [molec $cm^{-2}$]', fontsize=15)
ax3.set_ylabel('$NO_2$ $dSCD_{model}$ [molec $cm^{-2}$]', fontsize=15)
ax3.annotate('(b)', xy=(0.05, 0.95), xycoords='axes fraction', fontsize=20,
             horizontalalignment='center', verticalalignment='top')
plt.setp(ax3.get_xticklabels(), fontsize=15)
plt.setp(ax3.get_yticklabels(), fontsize=15)
# ax3.set_ylabel('Altitude [km]')
plt.savefig(f'temp/FigureS1.eps')
plt.savefig(f'temp/FigureS1.png')
plt.close()